package com.jpush.gateway.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;

import java.util.HashMap;
import java.util.Map;

@RestController
public class ProductWebController {
    @Autowired
    WebClient.Builder webClientBuilder;

    @GetMapping("/gateway")
    public Mono<String> findByIdWithAccounts(@RequestParam("id") String id) {
        return webClientBuilder.build().get().uri("http://jpush-product/push/product/gateway?id=" + id).retrieve().bodyToMono(String.class);
    }
}
